﻿using Cms.Core.Application.Service.RoleInfo.Dto;
using Cms.Core.Data.Model;
using Cms.Core.Infrastructure.Dependency;
using Cms.Core.Infrastructure.Ui;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Cms.Core.Application.IService.RoleInfo
{

    /// <summary>
    /// 角色接口
    /// </summary>
   public interface IRoleService : ITransientDependency
    {
        /// <summary>
        /// 添加角色
        /// </summary>
        /// <param name="input"></param>
        /// <param name="checkRoleFunc">来用检查角极委托</param>
        /// <returns></returns>
        Task<OperationResult> AddRoleAsync(RoleDto input, Func<string, string, Guid, Task> checkRoleFunc);

        /// <summary>
        /// 更新角色异步
        /// </summary>
        /// <param name="input">更新Dto实体</param>
        /// <param name="checkRoleFunc">来用检查角极委托</param>
        /// <returns></returns>
        Task<OperationResult> UpdateRoleAsync(RoleDto input, Func<string, string, Guid, Task> checkRoleFunc);

        /// <summary>
        /// 异步更新或者更新角色
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
         Task<OperationResult> UpdateOrAddRoleAsync(RoleDto input);


        /// <summary>
        /// 得到用户分页信息
        /// </summary>
        /// <param name="pageRequestData">分页请求数据</param>
        /// <returns></returns>

        Task<PageResult> GetRolePageDataAsync(PageRequestData pageRequestData);

        /// <summary>
        /// 最大排序号
        /// </summary>
        /// <returns></returns>
         Task<int> MaxOrderSortAsync();

        /// <summary>
        /// 异步加载角极
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
         Task<OperationResult<RoleDto>> LoadRoleAsync(Guid? id);

        /// <summary>
        /// 异步软删除
        /// </summary>
        /// <param name="id">主键ID</param>
        /// <returns></returns>
         Task<OperationResult> SoftDeleteRoleAsync(Guid id);

        /// <summary>
        /// 异步得到所有启用的角色数据
        /// </summary>
        /// <returns></returns>

        Task<IEnumerable<RoleDto>> GetAllEnableRoleListAsync();


        /// <summary>
        /// 把角色转成选择列表项
        /// </summary>
        /// <returns></returns>
        Task<OperationResult<IEnumerable<SelectListItem>>> ToRoleSelectListItem();



        /// <summary>
        /// 异步根据用户得到角色
        /// </summary>
        /// <param name="userId">用户ID</param>
        /// <returns></returns>
        Task<IEnumerable<SelectListItem>> GetRoleListByUserIdAsync(Guid userId);

        /// <summary>
        /// 得到所角色
        /// </summary>
        /// <returns></returns>
        IQueryable<SysRole> GetAllRoles();

        /// <summary>
        /// 异步得到所有用户角色
        /// </summary>
        /// <param name="userId"></param>
        /// <returns></returns>
        Task<IEnumerable<RoleDto>> GetUserRolesByUserIdAsync(Guid userId);


        /// <summary>
        /// 得到所有用户角色
        /// </summary>
        /// <param name="userId"></param>
        /// <returns></returns>
        IQueryable<RoleDto> GetUserRolesByUserId(Guid userId);
 
    }
}
